home *** CD-ROM | disk | FTP | other *** search
/ Ultra Gameplayers 109 / Ultra Gameplayers 109.iso / pc / media / new_ugp.dxr / 00203_Generic Hotspot Class.ls < prev    next >
Encoding:
Text File  |  1998-02-10  |  2.5 KB  |  104 lines

  1. property hotSprites, active, rollActions, rollOnActions, downActions, statusMessage, destination, clickSound, killList
  2.  
  3. on new me, paramList
  4.   set killList to []
  5.   set rollActions to []
  6.   set rollOnActions to []
  7.   set downActions to []
  8.   set hotSprites to getProp(paramList, #hotSprites)
  9.   if not voidp(getaProp(paramList, #statusMessage)) then
  10.     set statusMessage to NewObject(me, "Status Display Class", paramList)
  11.   end if
  12.   set destination to getaProp(paramList, #destination)
  13.   set clickSound to getaProp(paramList, #clickSound)
  14.   if not voidp(clickSound) then
  15.     if clickSound > 0 then
  16.       set clickSound to NewObject(me, "Sound FX Class", [#audioMember: clickSound])
  17.     end if
  18.   else
  19.     set clickSound to NewObject(me, "Sound FX Class", [#audioMember: "ugpMouseClick"])
  20.   end if
  21.   if voidp(destination) then
  22.     set destination to 0
  23.   end if
  24.   set active to 0
  25.   return me
  26. end
  27.  
  28. on AddRoll me, action
  29.   append(rollActions, action)
  30. end
  31.  
  32. on AddRollOnce me, action
  33.   append(rollOnActions, action)
  34. end
  35.  
  36. on AddDown me, action
  37.   append(downActions, action)
  38. end
  39.  
  40. on CheckRoll me, spritenum, lineNum
  41.   if getPos(hotSprites, spritenum) then
  42.     if objectp(statusMessage) then
  43.       TurnOn(statusMessage)
  44.     end if
  45.     repeat with action in rollActions
  46.       TurnOn(action, spritenum, lineNum)
  47.     end repeat
  48.     if not active then
  49.       repeat with action in rollOnActions
  50.         put "Roll On action:" && rollOnActions
  51.         TurnOn(action, spritenum, lineNum)
  52.       end repeat
  53.     end if
  54.     set active to 1
  55.     return 1
  56.   else
  57.     if objectp(statusMessage) then
  58.       TurnOff(statusMessage)
  59.     end if
  60.     repeat with action in rollActions
  61.       TurnOff(action, spritenum, lineNum)
  62.     end repeat
  63.     repeat with action in rollOnActions
  64.       TurnOff(action, spritenum, lineNum)
  65.     end repeat
  66.     set active to 0
  67.     return 0
  68.   end if
  69. end
  70.  
  71. on CheckDown me, spritenum, lineNum
  72.   if getPos(hotSprites, spritenum) then
  73.     put "CheckDown:" && spritenum
  74.     if objectp(clickSound) then
  75.       TurnOn(clickSound)
  76.     end if
  77.     repeat with action in downActions
  78.       put "====> " & action
  79.       TurnOn(action, spritenum, lineNum)
  80.     end repeat
  81.     return destination
  82.   else
  83.     return -1
  84.   end if
  85. end
  86.  
  87. on IsClickable me
  88.   return (count(downActions) > 0) or (destination > 0)
  89. end
  90.  
  91. on ShowedMessage me
  92.   return objectp(statusMessage)
  93. end
  94.  
  95. on dispose me
  96.   set rollActions to 0
  97.   set rollOnActions to 0
  98.   set downActions to 0
  99.   set hotSprites to 0
  100.   set destination to 0
  101.   ClearObjectList(killList)
  102.   set killList to []
  103. end
  104.